Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEVPROD-10103 Account for cross-build dependents in NumDependents #8560

Merged
merged 4 commits into from
Dec 20, 2024

Conversation

hadjri
Copy link
Contributor

@hadjri hadjri commented Dec 16, 2024

DEVPROD-10103

Description

The NumDependents field for tasks can be quite undercounted because it does not currently consider cross-variant dependencies.

  • Modify places that insert tasks in per-build batches to insert all tasks for the version in a single operation
  • Do not compute NumDependents for tasks until all tasks for the version have been created

Testing

Updated unit tests to confirm cross-variant dependencies are part of the final calculation.

@hadjri hadjri requested a review from a team December 18, 2024 20:09
@hadjri hadjri marked this pull request as ready for review December 18, 2024 20:09
Copy link
Contributor

@ZackarySantana ZackarySantana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I think all the comments I put are small enough they don't need a 2nd look at 🚀

if err = allTasks.InsertUnordered(ctx); err != nil {
return nil, errors.Wrap(err, "inserting tasks")
}
SetNumDependents(allTasks)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be above the insert like here?

@@ -738,6 +738,7 @@ func FinalizePatch(ctx context.Context, p *patch.Patch, requester string) (*Vers
},
)
}
SetNumDependents(tasksToInsert)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we call this here now too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the CreateBuildFromVersionNoInsert calls that occur inside the loop no longer set the tasks num dependents field, we now need to do it right before we insert all tasks for the version

@@ -980,6 +980,8 @@ func createVersionItems(ctx context.Context, v *model.Version, metadata model.Ve
})
}

model.SetNumDependents(tasksToCreate)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here? This is just for my curiosity but if the reason is involved enough, it might be worth adding a comment since it doesn't seem to affect the adjacent logic

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same rationale as the other comment

}
assert.NoError(t, previouslyActivatedVersion.Insert())

// insert distros used in testing.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this needs a comment.

pp, err := model.LoadProjectInto(ctx, []byte(simpleYml), nil, "testproject", p)
assert.NoError(t, err)

// create new version to use for activating
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// create new version to use for activating
// Create new version to use for activating.

},
},
}
assert.NoError(t, previouslyActivatedVersion.Insert())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you convert the ones checking for errors to requires for this test function? I think the only one that shouldn't be for sure is assert.NoError(t, repoTracker.StoreRevisions(ctx, revisions)) L376

p := &model.Project{}
pp, err := model.LoadProjectInto(ctx, []byte(simpleYml), nil, "testproject", p)
assert.NoError(t, err)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
require.NotNil(t, pp)

Looking at LoadProjectInto, I don't think it can ever return a nil ParserProject when the error is not nil. I'm not sure if we should double check that in the test in case the function changes or it will be consistent. Feel free to decline this suggestion if you think so!

@hadjri hadjri merged commit b462ffd into evergreen-ci:main Dec 20, 2024
10 checks passed
ZackarySantana pushed a commit to ZackarySantana/evergreen that referenced this pull request Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants